/**
 * @author LKQ
 * @date 2022/1/8 15:40
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.reverseVowels("ai"));
    }
    public String reverseVowels(String s) {
        char[] arr = s.toCharArray();
        int l = 0, r = arr.length - 1;
        while (l < r) {
            if (isYuan(arr[l]) && isYuan(arr[r])) {
                char temp = arr[r];
                arr[r] = arr[l];
                arr[l] = temp;
                l++;
                r--;
            }else if (!isYuan(arr[l])) {
                l++;
            }else if (!isYuan(arr[r])) {
                r--;
            }
        }
        return new String(arr);
    }
    public boolean isYuan(char c) {
        switch (c) {
            case 'a':
            case 'e':
            case 'i':
            case 'o':
            case 'u':
            case 'A':
            case 'E':
            case 'I':
            case 'O':
            case 'U': return true;
            default: return  false;
        }
    }
}
